package com.ruoyi.sycs.domain.bo;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.core.validate.QueryGroup;
import com.ruoyi.common.exception.ServiceException;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import com.ruoyi.common.core.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;


/**
 * 器具明细表业务对象 sycs_ba_qj_detail
 *
 * @author zyb
 * @date 2024-04-12
 */

@Data
@EqualsAndHashCode(callSuper = true)
public class BaQjDetailBo extends BaseEntity implements Serializable {

    /**
     * 主键
     */
    private Long detailId;

    /**
     * 关联器具id
     */
    @NotNull(groups = QueryGroup.class, message = "qjId不能为空")
    private Long qjId;

    /**
     * 备注
     */
    private String remark;

    /**
     * 盒号
     */
    private String hh;


    /**
     * 质量(g)
     */
    private String quality;
    /**
     * 筒容积
     */
    private String tongrj;

    /**
     * 标定日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private String hTime;
    private String htime;
    /**
     * 标定人员
     */
    private String hPer;
    private String hper;
    /**
     * 状态
     */
    private String status;

    private String syQjName;

    /**
     * 所属试验室id
     */
    @NotNull(groups = QueryGroup.class, message = "试验室ID不能为空")
    private Long deptId;

    /**
     * excelId
     */
    @NotNull(groups = QueryGroup.class, message = "excelId不能为空")
    private Long excelId;

    /**
     * 试验检测日期 yyyy年MM月dd日 格式的字符串
     */
    @NotNull(groups = QueryGroup.class, message = "试验检测日期不能为空")
    private String shiyjcrq;
    private Date useDate;

    public void setShiyjcrq(String shiyjcrq) {
        this.shiyjcrq = shiyjcrq;
        try {
            this.useDate = DateUtil.parse(shiyjcrq, Constants.EXCEL_DATE_FORMAL);
        } catch (Exception e) {
            throw new ServiceException("试验检测日期 yyyy年MM月dd日 格式.");
        }
    }

    public void setHh(String hh) {
        this.hh = StrUtil.trim(hh);
    }
}
